home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / New System Software Extensions / OpenDoc A6 / OpenDoc Parts Framework / OPF / Examples / Clock / Include / ClockFac.h < prev    next >
Encoding:
Text File  |  1994-04-21  |  2.6 KB  |  84 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                ClockFac.h
  4. //    Release Version:    $ 1.0d1 $
  5. //
  6. //    Author:                Lonnie Millett
  7. //    Creation Date:        3/28/94
  8. //
  9. //    Copyright:    © 1993, 1994 by Apple Computer, Inc., all rights reserved.
  10. //
  11. //========================================================================================
  12.  
  13. #ifndef CLOCKFAC_H
  14. #define CLOCKFAC_H
  15.  
  16. // ----- Framework Includes -----
  17.  
  18. #ifndef FWFACET_H
  19. #include <FWFacet.h>
  20. #endif
  21.  
  22. // ----- Graphic Includes -----
  23.  
  24. #ifndef FWRECT_H
  25. #include <FWRect.h>
  26. #endif
  27.  
  28. //==============================================================================
  29. // Classes defined in this interface
  30. //==============================================================================
  31.  
  32. class CClockFacet;
  33.  
  34. //==============================================================================
  35. // Classes used by this interface
  36. //==============================================================================
  37.  
  38. class XMPFacet;
  39. class XMPShape;
  40. class CClockFrame;
  41. class XMPDragItemIterator;
  42.  
  43. //==============================================================================
  44. // CClockFacet
  45. //==============================================================================
  46.  
  47. class CClockFacet : public FW_CFacet
  48. {
  49. public:
  50.     CClockFacet();
  51.     virtual ~CClockFacet();
  52.     void InitClockFacet(XMPFacet* xmpFacet, CClockFrame* clockFrame);
  53.     
  54.     CClockFrame* GetClockFrame();
  55.     
  56.     virtual void Draw(FW_CGraphicContext *gc);
  57.     
  58.     virtual void DragEnter(XMPDragItemIterator* dragInfo, const FW_CPoint& where);
  59.     
  60.     void     UpdateAnalogClock(FW_CGraphicContext *gc, unsigned long tickCount);
  61.     void     UpdateDigitalClock(FW_CGraphicContext *gc, unsigned long tickCount);
  62.  
  63. private:
  64.     void    CalcPoint(FW_CPoint* point, XMPCoordinate radius, const XMPPoint& center, const FW_CRect& frame, Fixed angle);
  65.     void     DrawClockFace(FW_CGraphicContext *gc);
  66.     void     DrawClockHands(FW_CGraphicContext *gc, unsigned long tickCount);
  67.     void     DrawHourHand(FW_CGraphicContext *gc, const FW_CRect& clockRect, const FW_CPoint& centerPoint, Fixed hour, Fixed minute);
  68.     void     DrawMinuteHand(FW_CGraphicContext *gc, const FW_CRect& clockRect, const FW_CPoint& centerPoint, Fixed minute);
  69.     void     DrawSecondHand(FW_CGraphicContext *gc, const FW_CRect& clockRect, const FW_CPoint& centerPoint, Fixed second);
  70.  
  71. private:
  72.         CClockFrame* fClockFrame;
  73. };
  74.  
  75. //----------------------------------------------------------------------------------------
  76. // CClockFacet::GetClockFrame()
  77. //----------------------------------------------------------------------------------------
  78. inline CClockFrame* CClockFacet::GetClockFrame()
  79. {
  80.     return fClockFrame;
  81. }
  82.  
  83. #endif
  84.